import React, { Component } from 'react'
import './index.less'
import api from '@MODULES/common/api'
import { NavLink, withRouter } from 'react-router-dom'
import store from 'store'
import Layout from '../../common/Layout'
import Header from '../../common/Header'
import TabBar from '../../common/TabBar'
import common from '../../common/common'




class Index extends Component {

    constructor(props) {
        super(props)
        this.state = {
            initialization: true,
            user:''
        }
    }

    componentDidMount() {
        common.userInfoUpData((data) => {
            this.setState({
                user:data
            })
        })
    }
    onWindowResize() {
    }

    render() {
        return (
            <Layout>
                {
                    this.state.initialization ? <div id="main">

                        <div className="fontZero topLayoutBox LayoutBox">
                            <div className="leftItem itemBox">
                                <img onClick={() => {
                                    this.props.history.push('/purchaserecord')
                                }} src={require('../../common/img/project/pic_shengjimendian.png')} alt="" />
                            </div>
                            <div className="rightItem itemBox">
                                <div>
                                    <img onClick={() => {
                                        this.props.history.push('/video')
                                    }} src={require('../../common/img/project/pic_mendianbuhuo.png')} alt="" />
                                </div>
                                <div>
                                    <img onClick={() => {
                                        this.props.history.push('/share')
                                    }} src={require('../../common/img/project/pic_yaoqinghaoyou.png')} alt="" />
                                </div>
                            </div>
                        </div>

                        <div className="fontZero LayoutBox middleLayoutBox">
                            <div className="itemBox" onClick={() => {
                                this.props.history.push('/shop/cart')
                            }}>
                                <img src={require('../../common/img/project/pic_jiejing_gouwuche.png')} alt="" />
                                <div className="showText">
                                    <div className='title'>购物</div>
                                    <div className="label">您的爱好研究所</div>
                                </div>
                            </div>
                            <div className="itemBox" onClick={() => {
                                this.props.history.push('/tasklist')
                            }}>
                                <img src={require('../../common/img/project/pic_jiejing_dingdanguanli.png')} alt="" />
                                <div className="showText">
                                    <div className='title'>订单管理</div>
                                    <div className="label">实时跟踪更放心</div>
                                </div>
                            </div>
                        </div>

                        <div className="fontZero threeColumnLayout bottomLayoutBox">
                            <div className="itemBox">
                                <img onClick={() => {
                                    this.props.history.push('/myself')
                                }} className="centerEnter" src={require('../../common/img/project/pic_gerenzhongxin.png')} alt="" />
                            </div>
                            <div className="itemBox">
                                <div className="quickEnter" onClick={() => {
                                    this.props.history.push('/recommend')
                                }}>
                                    <div className="quickShowBox fontZero">
                                        <img className="quickShowIcon" src={require('../../common/img/project/icon_jiejing_wodeyue.png')} alt="" />
                                        <span className="quickShowText">我的余额</span>
                                    </div>
                                </div>
                                <div className="quickEnter" onClick={() => {
                                    this.props.history.push('/discount')
                                }}>
                                    <div className="quickShowBox fontZero">
                                        <img className="quickShowIcon" src={require('../../common/img/project/icon_jiejing_zhekoujin.png')} alt="" />
                                        <span className="quickShowText">折扣金</span>
                                    </div>
                                </div>
                                <div className="quickEnter" onClick={() => {
                                    this.props.history.push('/setUp')
                                }}>
                                    <div className="quickShowBox fontZero">
                                        <img className="quickShowIcon" src={require('../../common/img/project/icon_jiejing_gerenxinxi.png')} alt="" />
                                        <span className="quickShowText">个人信息</span>
                                    </div>
                                </div>
                            </div>
                            <div className="itemBox">
                                <div className="quickEnter" onClick={() => {
                                    this.props.history.push('/interest')
                                }}>
                                    <div className="quickShowBox fontZero">
                                        <img className="quickShowIcon" src={require('../../common/img/project/icon_jiejing_shouyi.png')} alt="" />
                                        <span className="quickShowText">我的收益</span>
                                    </div>
                                </div>
                                <div onClick={() => {
                                    this.props.history.push('/team/'+this.state.user.id)
                                }} className="quickEnter">
                                    <div className="quickShowBox fontZero">
                                        <img className="quickShowIcon" src={require('../../common/img/project/icon_jiejing_tuandui.png')} alt="" />
                                        <span className="quickShowText">我的团队</span>
                                    </div>
                                </div>
                                <div onClick={() => {
                                    this.props.history.push('/recAddress')
                                }} className="quickEnter">
                                    <div className="quickShowBox fontZero">
                                        <img className="quickShowIcon" src={require('../../common/img/project/icon_jiejing_dizhiguanli.png')} alt="" />
                                        <span className="quickShowText">地址管理</span>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <TabBar content="index" />
                    </div> : ''
                }
            </Layout>
        )
    }

}
export default withRouter(Index)